depends	= gdk-2.0 gtk+-2.0 imlib2 libexif
dev_packages = libgtk2.0-dev libimlib2-dev libexif-dev
headers = vimview.h
sources	= main.c imgwin.c options.c
objects	= $(sources:.c=.o)

CC	= gcc

# Make sure that the dependencies we have exist
$(if $(shell pkg-config --exists $(depends) && echo 1), \
    ,\
    $(error Could not resolv dependencies: $(depends). On Debian based \
	systems try installing $(dev_packages)))

ifdef NO_DEBUG
    CFLAGS += -DNDEBUG
else
    CFLAGS += -DDEBUG -g
endif

CFLAGS	+= -Wall
CFLAGS	+= $(shell pkg-config $(depends) --cflags)
LDLIBS	+= $(shell pkg-config $(depends) --libs)

%.o :  %.c $(headers)
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@


vimview: $(objects)
	$(CC) $(LDFLAGS) $(LOADLIBES) $(LDLIBS) $^ -o vimview

imlib2_view: imlib2_view.o

clean:
	rm -f *.o vimview
